package com.gec.hawaste.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/** 跳转页面的控制器
 *
 * @author : [chenxys]
 * @version : [v1.0]
 */
@Slf4j
@Controller
public class SysController {
    /**
     * 一级菜单匹配
     * @author chenxys
     */
    @RequestMapping("{url}.html")
    public String url(@PathVariable("url") String url){
        log.info("跳转页面{}",url);
        return url;
    }

    /**
     * 一级菜单匹配
     * @author chenxys
     */
    @RequestMapping("{module}/{url}.html")
    public String url(@PathVariable("module") String module,@PathVariable("url") String url){
        log.info("跳转页面{}",(module + "/" + url));
        return module + "/" + url;
    }

    /**
     * 三级菜单匹配
     * @author chenxys
     */
    @RequestMapping("{module}/{classify}/{url}.html")
    public String url(@PathVariable("module") String module,
                      @PathVariable("classify") String classify,
                      @PathVariable("url") String url){
        log.info("跳转页面{}",(module + "/" + classify + "/" + url));
        return module + "/" + classify + "/" + url;
    }

    /**
     * 四级菜单匹配
     * @author chenxys
     */
    @RequestMapping("{module}/{classify}/{second}/{url}.html")
    public String url(@PathVariable("module") String module,
                      @PathVariable("classify") String classify,
                      @PathVariable("second") String second,
                      @PathVariable("url") String url){
        log.info("跳转页面{}",(module + "/" + classify + "/" + second + "/" + url));
        return module + "/" + classify + "/" + second + "/" + url;
    }
}
